home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
Updates, etc.
/
PG PRO⁄PG Lite Demos
/
PG Writer π
/
Edit Menu.FLTR
< prev
next >
Wrap
Text File
|
1994-03-28
|
6KB
|
170 lines
'===============================================================================
'= Copyright 1992 Staz™ Software, Inc. =
'= All rights reserved =
'= "Edit Menu.FLTR" from PG:PRO =
'===============================================================================
INCLUDE FILE _aplIncl
COMPILE 0,_MacsbugLabels_strResource_caseInsensitive'set by PG:PRO
GLOBALS "PG PRO.GLBL"'include standard global file
END GLOBALS'no other globals
DEFSTR LONG'needed for CVI's
GOTO "EM:Start"'ALWAYS jump around functions
INCLUDE "@Header.INCL"
'-------------------------------- Local Equates --------------------------------
_EMUndoItem = 1
_EMCutItem = 3
_EMCopyItem = 4
_EMPasteItem = 5
_EMClearItem = 6
_EMSelectAllItem = 7
'_______________________________________________________________________________
LOCAL FN EMenableUndo'∑∑œœœœœœœœœœœœœœœœœœœœœœœœœ∑∑
'—————————————————————————————————————————————————————————————————————————————
theField = WINDOW(_EFnum)'current field
DEF DISPOSEH(gUndoHndl&)'dump undo handle
LONG IF theField'a field is active
LONG IF WINDOW(_EFClass) > 0'not a pict field
LONG IF WINDOW(_EFTextLen)'•• 10/29/92 ••
temp$ = STR#(_baseID - 3,1)'"Edit"
editMenu = FN pGfindMenu(temp$)'got this menu?
GET FIELD gUndoHndl&,theField'get the info
gUndoStart = WINDOW(_selStart)'undo selection start
gUndoEnd = WINDOW(_selEnd)'undo selection end
END IF'•• 10/29/92 ••
END IF
END IF
END FN
'_______________________________________________________________________________
LOCAL FN EMautoMenu'∑∑œœœœœœœœœœœœœœœœœœœœœœœœœ∑∑
'—————————————————————————————————————————————————————————————————————————————
mHndl& = FN GETMHANDLE(gWhichMenu)
LONG IF mHndl&
theTitle$ = PSTR$([mHndl&] + _menuData)
LONG IF theTitle$ = STR#(_baseID - 4,1)'get name of font menu
FN EMenableUndo:gUndoable = _zTrue
END IF
LONG IF theTitle$ = STR#(_baseID - 4,2)'get name of size menu
FN EMenableUndo:gUndoable = _zTrue
END IF
LONG IF theTitle$ = STR#(_baseID - 4,3)'get name of style menu
FN EMenableUndo:gUndoable = _zTrue
END IF
LONG IF theTitle$ = STR#(_baseID - 3,1)
CALL GETITEM(mHndl&,gWhichItem,theItem$)
SELECT theItem$
CASE STR#(_baseID - 3,2)'"Undo" item
EDIT FIELD WINDOW(_EFnum),&gUndoHndl&
SETSELECT gUndoStart,gUndoEnd
gUndoable = _false
CASE STR#(_baseID - 3,3)'"Select All" item
LONG IF WINDOW(_EFnum)
SETSELECT 0,WINDOW(_EFTextLen)
END IF
END SELECT
END IF
END IF
END FN
'_______________________________________________________________________________
LOCAL FN EMfixEditMenu'∑∑œœœœœœœœœœœœœœœœœœœœœœœœœ∑∑
'—————————————————————————————————————————————————————————————————————————————
selAllItem = 0
lastItem = _EMClearItem
temp$ = STR#(_baseID - 3,1)
editMenu = FN pGfindMenu(temp$)
mHndl& = FN GETMHANDLE(editMenu)
LONG IF mHndl&
itemCount = FN COUNTMITEMS(mHndl&)
FOR thisItem = 1 TO itemCount
CALL GETITEM(mHndl&,thisItem,temp$)
LONG IF UCASE$(temp$) = "SELECT ALL"
selAllItem= thisItem
thisItem = itemCount
END IF
NEXT
IF selAllItem THEN MENU editMenu,selAllItem,_disable
LONG IF SYSTEM(_aplActive) = 0'DA in front
MENU editMenu,_EMUndoItem ,_enable,"Undo"
MENU editMenu,_EMCutItem ,_enable
MENU editMenu,_EMCopyItem ,_enable
MENU editMenu,_EMPasteItem ,_enable
MENU editMenu,_EMClearItem ,_enable
XELSE
LONG IF WINDOW(_activeWnd) = 0 OR gUndoHndl& = 0 OR gUndoable = 0
temp$ = STR#(_baseID - 3,4)
MENU editMenu,_EMUndoItem,_disable,temp$
XELSE
temp$ = STR#(_baseID - 3,2)
MENU editMenu,_EMUndoItem,_enable,temp$
END IF
FOR x = _EMCutItem TO _EMClearItem
MENU editMenu,x,0
NEXT
theField = WINDOW(_EFnum)'get current field num
LONG IF theField'any active field?
LONG IF WINDOW(_EFClass)>0'not a pict field
LONG IF WINDOW(_textClip)'text in scrap
MENU editMenu,_EMPasteItem,_enable'enable paste
END IF
LONG IF WINDOW(_EFTextLen)'non-zero lgth
LONG IF WINDOW(_selStart) <> WINDOW(_selEnd)'non-zero selection range
MENU editMenu,_EMCutItem ,_enable'OK to cut,copy clear
MENU editMenu,_EMCopyItem ,_enable
MENU editMenu,_EMClearItem ,_enable
END IF
IF selAllItem THEN MENU editMenu,selAllItem,_enable'select all
END IF
END IF
END IF
END IF
END IF
END FN
'_______________________________________________________________________________
LOCAL FN EMcheckScrapSize'∑∑œœœœœœœœœœœœœœœœœœœœœœœœœ∑∑
'—————————————————————————————————————————————————————————————————————————————
LONG IF gWhat = 16
temp$ = STR#(_baseID - 3,1)
editMenu = FN pGfindMenu(temp$)
LONG IF gWhereY = editMenu
LONG IF gWhereX = _EMPasteItem
theSize& = FN GETSCRAP(0,_"TEXT",offSet&)
LONG IF theSize& + WINDOW(_EFTextLen) > 32750&
% EVENT,0
EVENT% = 7
DIALOG = _showErr
END IF
END IF
END IF
END IF
END FN
'_______________________________________________________________________________
'€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ EDIT FILTER €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
'———————————————————————————————————————————————————————————————————————————————
"EM:Start"
SELECT gAction
CASE _mouseAction'pass quickly
CASE _menuAction :FN EMautoMenu
CASE _mainAction :IF gSubAction = _mainShutDown THEN DEF DISPOSEH(gUndoHndl&)
CASE _otherAction :IF gSubAction = _otherBeforeMenu THEN FN EMfixEditMenu
LONG IF gSubAction = _otherFilterEvent
FN EMcheckScrapSize
END IF
CASE _windowAction:IF gSubAction = _windowActivate THEN FN EMenableUndo
CASE _fieldAction
SELECT gSubAction
CASE _fieldActivate:FN EMenableUndo:gUndoable = _false
CASE _fieldChanging:FN EMenableUndo:gUndoable = _zTrue
CASE _fieldKeyPressed :gUndoable = _zTrue
LONG IF WINDOW(_selStart) < WINDOW(_selEnd)
FN EMenableUndo
END IF
LONG IF WINDOW(_EFTextLen) > 32750&
gKey$ = "":gAction = 0
EVENT% = 8
DIALOG = _showErr
END IF
END SELECT
END SELECT